package vip.zhaotao.utils;

import freemarker.template.TemplateException;

import java.io.IOException;
import java.io.OutputStream;

/**
 * Excel工具类
 */
public class ExcelUtils {

    /**
     * 生成Excel xlsx格式文件
     *
     * @param outputStream 输出流
     * @param dataModel    数据
     * @throws IOException
     * @throws TemplateException
     */
    public static void generateXlsxFile(OutputStream outputStream,
                                        Object dataModel) throws IOException, TemplateException {
        FileUtils.generateFile(
                outputStream,
                dataModel,
                "template/excel",
                "excel.xlsx",
                "xl",
                "sharedStrings.xml",
                "sharedStrings.ftl"
        );
    }
}
